﻿/***********************************************************************
 * <copyright file="CustomerEntity.cs" company="BUCA JSC">
 * -->    Copyright (C) statement. All right reserved
 * </copyright>
 * 
 * Created:   Hoàng Bích Sơn
 * Email:    sonhb@buca.vn
 * Website:
 * Create Date: Friday, March 7, 2014
 * Usage: 
 * 
 * RevisionHistory: 
 * Date         Author               Description 
 * 
 * ************************************************************************/


using BusinessObjects.BusinessRules;

namespace BusinessObjects.BussinessDictionary
{

    /// <summary>
    /// CustomerEntity class
    /// </summary>
    public class Customer : BusinessObject 
    {

        /// <summary>
        /// </summary>
        public Customer()
        {
            //validateId
            AddRule(new ValidateId("CustomerId"));
            //validateRequired
            //AddRule(new ValidateRequired("UnitID"));
            AddRule(new ValidateRequired("Code"));
            AddRule(new ValidateRequired("Name"));
            AddRule(new ValidateRequired("IsActive"));
            //validateLength
            AddRule(new ValidateLength("Code", 0, 20));
            AddRule(new ValidateLength("Name", 0, 255));
            //AddRule(new ValidateLength("Fax", 0, 20));
            //AddRule(new ValidateLength("Address", 0, 255));
            //AddRule(new ValidateLength("PhoneNumber", 0, 20));
            //AddRule(new ValidateLength("ContactName", 0, 255));
            //AddRule(new ValidateLength("CompanyName", 0, 255));
            //AddRule(new ValidateLength("Description", 0, 255));
        }

        /// <summary>
        /// </summary>
        /// <param name="customerId"></param>
        /// <param name="unitId"></param>
        /// <param name="code"></param>
        /// <param name="name"></param>
        /// <param name="address"></param>
        /// <param name="phoneNumber"></param>
        /// <param name="fax"></param>
        /// <param name="companyName"></param>
        /// <param name="contactName"></param>
        /// <param name="description"></param>
        /// <param name="isActive"></param>
        public Customer(int customerId, long unitId, string code, string name, string address,
                        string phoneNumber, string fax, string companyName, string contactName, string description,
                        bool isActive)
            : this()
        {
            CustomerId = customerId;
            UnitId = unitId;
            Code = code;
            Name = name;
            Address = address;
            PhoneNumber = phoneNumber;
            Fax = fax;
            CompanyName = companyName;
            ContactName = contactName;
            Description = description;
            IsActive = isActive;
        }

        /// <summary>
        /// </summary>
        public int CustomerId { get; set; }

        /// <summary>
        /// </summary>
        public long UnitId { get; set; }

        /// <summary>
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// </summary>
        public string Address { get; set; }

        /// <summary>
        /// </summary>
        public string PhoneNumber { get; set; }

        /// <summary>
        /// </summary>
        public string Fax { get; set; }

        /// <summary>
        /// </summary>
        public string CompanyName { get; set; }

        /// <summary>
        /// </summary>
        public string ContactName { get; set; }

        /// <summary>
        /// </summary>
        public string Description { get; set; }

        /// <summary>
        /// </summary>
        public bool IsActive { get; set; }
    }
}
